package com.hk.yajin.function.index;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.hk.developmentlib.utills.UiUtil;
import com.hk.yajin.R;
import com.hk.yajin.model.LunBoData;
import com.hk.yajin.model.Video;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.LoopPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 伦哥哥 on 2017/6/25.
 */

public class IndexVideoLunBoAdapter extends LoopPagerAdapter {
    private List<Video> data = new ArrayList<>();
    private Context context;

    public IndexVideoLunBoAdapter(List<Video> images, Context activity, RollPagerView viewPager) {
        super(viewPager);
        data = images;
        context = activity;
    }


    @Override
    public View getView(ViewGroup viewGroup, int position) {

        View view = UiUtil.inflate(R.layout.list_head_index_lunbo);
        TextView tv_lunbo_item = (TextView) view.findViewById(R.id.tv_lunbo_item);
        if (!TextUtils.isEmpty(data.get(position).getV_title())) {
            tv_lunbo_item.setText(data.get(position).getV_title());
        } else {
            tv_lunbo_item.setText("");
        }
        ImageView iv_lunbo_item = (ImageView) view.findViewById(R.id.iv_lunbo_item);
        UiUtil.showNormalImage(iv_lunbo_item, data.get(position).getV_cover());
        return view;
    }


    @Override
    public int getRealCount() {
        return data.size();
    }


}
